<?php

namespace app\api\model;

use think\Model;
use think\Db;
class ChannelModel extends Model
{
    private static $instance = null;

	public function __construct($data = [])
    {
        parent::__construct($data);
    }

    /**
     * 插入订单信息
     */
    public function addTiktok($data)
    {
        $addData = [
            'name' => $data['name'],
            'phone' => $data['phone'],
            'industry' => $data['industry'],
            'company' => $data['company'],
            'career_type' => $data['career_type'],
            'principal' => $data['principal'],
            'catch' => $data['catch'],
            'create_time' => date('Y-m-d H:i:s'),
        ];
        file_put_contents('./error_log.txt',print_r($addData,true).PHP_EOL,FILE_APPEND);
        return Db::name('drainage_data')->insert($addData);
    }

    /**
     * 插入推广信息
     */
    public function insertDrainage($data)
    {
        return Db::name('drainage_data')->insert($data);
    }
    
    /**
     * 检查手机号是否已经录入手机
     */
    public function checkPhone($phone)
    {
        return Db::name('drainage_data')->where(array('phone'=>$phone))->find();
    }
}